<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates a new instance</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ds-queue.clear.html">« Ds\Queue::clear</a></li>
      <li style="float: right;"><a href="ds-queue.copy.html">Ds\Queue::copy »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.ds-queue.html">Queue</a></li>
    <li>Creates a new instance</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="ds-queue.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ds\Queue::__construct</h1>
  <p class="verinfo">(PECL ds &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Queue::__construct</span> &mdash; <span class="dc-title">Creates a new instance</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ds-queue.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Ds\Queue::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$values</code><span class="initializer"> = ?</span></span>)</div>

  <p class="para rdfs-comment">
    Creates a new instance, using either a <span class="classname"><a href="class.traversable.html" class="classname">traversable</a></span>
    object or an <span class="type">array</span> for the initial <code class="parameter">values</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-ds-queue.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">values</code></dt>

    <dd>

     <p class="para">
      A traversable object or an <span class="type">array</span> to use for the initial values.
     </p>
    </dd>

   
  </dl>

 </div>


 


 <div class="refsect1 examples" id="refsect1-ds-queue.construct-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-4168">
   <p><strong>示例 #1 <span class="function"><strong>Ds\Queue::__construct()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$queue&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;\</span><span style="color: #0000BB">Ds</span><span style="color: #007700">\</span><span style="color: #0000BB">Queue</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$queue</span><span style="color: #007700">);<br /><br /><br /></span><span style="color: #0000BB">$queue&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;\</span><span style="color: #0000BB">Ds</span><span style="color: #007700">\</span><span style="color: #0000BB">Queue</span><span style="color: #007700">([</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$queue</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>以上例程的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
object(Ds\Queue)#2 (0) {
}
object(Ds\Queue)#2 (3) {
  [0]=&gt;
  int(1)
  [1]=&gt;
  int(2)
  [2]=&gt;
  int(3)
}
</pre></div>
   </div>
  </div>
 </div>



</div></div></div></body></html>